package com.zzx.boot.controller;

import com.zzx.boot.servlet.FollowService;
import com.zzx.boot.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author tan
 * @version 1.0
 * @date 2023/7/11 13:36
 */
@RestController
@RequestMapping("/follow")
@Api(tags = "粉丝关注模块")
@RequiredArgsConstructor
public class FollowController {

    private final FollowService followService;

    @ApiOperation(value = "关注用户")
    @PostMapping("/{followId}")
    public R addFollow(@PathVariable("followId")Long followId){
        return R.success(followService.addFollow(followId));
    }

    @ApiOperation(value = "取消关注")
    @DeleteMapping("/{followId}")
    public R removeFollow(@PathVariable("followId")Long followId){
        return R.success(followService.removeFollow(followId));
    }

    @ApiOperation(value = "互相列表")
    @GetMapping("/page/{current}")
    public R mutualFollow(@PathVariable("current")Long current){
        return R.success(followService.mutualFollow(current));
    }

    @ApiOperation(value = "粉丝列表")
    @GetMapping("/fans/page/{current}")
    public R fansFollow(@PathVariable("current")Long current){
        return R.success(followService.fansFollow(current));
    }

    @ApiOperation(value = "关注列表")
    @GetMapping("/list/page/{current}")
    public R followList(@PathVariable("current")Long current){
        return R.success(followService.followList(current));
    }

}
